package net.whzjkj.gateway.web.service;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import net.whzjkj.gateway.model.vo.QueueMessageVO;
import net.whzjkj.gateway.web.config.RabbitConfig;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: Mr.Hu
 * @create: 2018-11-06 14:45
 **/
@Slf4j
@Service
public class ReceiverService {

    @RabbitListener(queues = {RabbitConfig.MESSAGE_DATA_QUEUENAME})
    @RabbitHandler
    public void process(String message) {
        QueueMessageVO msg = JSONObject.parseObject(message, QueueMessageVO.class);
        log.info("Receiver : " + msg.getMessageId());
    }
}
